/**
 * @(#)LocalRower.java		
 * 
 * History:
 * 1.0	18 May 2012
 * 		Created
 */
package upm.pb4agent.team1.util;

import jade.core.AID;

import java.util.HashMap;

import upm.pb4agent.team1.team.Constant.DockNumber;

/**
 * A helper class: 1) to sort the rowers based on their values (strength +
 * resistance + agility) 2) for recoding purpose
 * 
 * @version 1.0
 * @author Bob Nicolaus
 * 
 */
public class LocalRower implements Comparable<LocalRower> {
	private String name;
	private float strength;
	private float resistance;
	private float agility;
	private AID agentID;
	private DockNumber dock;
	private float value = -1;
	private float timeRow;
	private float tiredness;
	private HashMap<String, Long> oarHashMap;

	public LocalRower(String rowerName, float rowerStrength,
			float rowerResistance, float rowerAgility) {
		name = rowerName;
		strength = rowerStrength;
		resistance = rowerResistance;
		agility = rowerAgility;
		timeRow = 0;
		tiredness = 0;
		setOarHashMap(new HashMap<String, Long>());
		calculateValue();
	}

	/**
	 * Sort from biggest to smallest
	 */
	public int compareTo(LocalRower anotherRower) {
		if (value == anotherRower.value) {
			return 0;
		} else if (value > anotherRower.value) {
			return -1;
		} else {
			return 1;
		}
	}

	private void calculateValue() {
		if (value == -1) {
			value = strength + resistance + agility;
		}
	}

	public String getName() {
		return name;
	}

	public float getStrength() {
		return strength;
	}

	public float getResistance() {
		return resistance;
	}

	public float getAgility() {
		return agility;
	}

	public AID getAgentID() {
		return agentID;
	}

	public void setAgentID(AID agentID) {
		this.agentID = agentID;
	}

	public DockNumber getDock() {
		return dock;
	}

	public void setDock(DockNumber dock) {
		this.dock = dock;
	}

	public float getTimeRow() {
		return timeRow;
	}

	public void setTimeRow(float timeRow) {
		this.timeRow = timeRow;
	}

	public float getTiredness() {
		return tiredness;
	}

	public void setTiredness(float tiredness) {
		this.tiredness = tiredness;
	}

	public HashMap<String, Long> getOarHashMap() {
		return oarHashMap;
	}

	public void setOarHashMap(HashMap<String, Long> oarHashMap) {
		this.oarHashMap = oarHashMap;
	}
}
